pid=$(ps -ef | grep user-center | grep -v grep | awk '{print $2}')

if [ ! -z "$pid" ]; then
  echo "当前运行user-center服务的pid是: ${pid}"
  kill -9 ${pid}
  echo -e "已结束当前user-center服务~\n"
else
  echo -e "目前未运行user-center服务!\n"
fi

nohup /opt/software/jdk-17.0.9/bin/java -jar -XX:+HeapDumpOnOutOfMemoryError -Xms512m -Xmx512m -Xmn200m -Xss256k -Dspring.profiles.active=test user-center.jar >out.log 2>&1 &

sleep 7

pid=$(ps -ef | grep user-center | grep -v grep | awk '{print $2}')
if [ ! -z "$pid" ]; then
  echo "user-center启动成功, pid是: ${pid}"
else
  echo -e "user-center启动失败!\n"
fi
